import Vue from 'vue'
import VueRouter from 'vue-router'
// import HomeView from '../views/HomeView.vue'
import LoginView from '@/views/login/index.vue'
import NotFoundView from '@/views/notfound/index.vue'
import LayoutView from '@/views/layout/index.vue'
import CourseView from '@/views/course/index.vue'
import courseList from '@/components/CourseList.vue'
import CourseSelect from '@/components/CourseSelect.vue'
import CourseSelected from '@/components/CourseSelected.vue'
import UserAdd from '@/components/User/UserAdd.vue'
import UserList from '@/components/User/UserList.vue'
import RecordsList from '@/views/record/index.vue'
Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/',
  //   name: 'home',
  //   component: HomeView
  // },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView
  },
  {
    path: '/home',
    name: 'layout',
    component: LayoutView,
    children: [
      {
        path: '/home/record',
        name: 'record',
        component: RecordsList
      },
      {
        path: '/home/course',
        name: 'course',
        component: CourseView,
        children: [
          {
            path: '/home/course/list',
            name: 'courseList',
            component: courseList
          },
          {
            path: '/home/course/select',
            name: 'courseList',
            component: CourseSelect
          },
          {
            path: '/home/course/selected',
            name: 'courseList',
            component: CourseSelected
          }
        ]
      },
      {
        path: '/home/userlist',
        name: 'userList',
        component: UserList
      },
      {
        path: '/home/useradd',
        name: 'userAdd',
        component: UserAdd
      }
    ]
  },
  {
    path: '*',
    name: 'notfound',
    component: NotFoundView
  }
]

const router = new VueRouter({
  routes
})

export default router
